package com.ts.audiocamera

import android.Manifest
import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat

class OpenglActivity : AppCompatActivity() {
//    var sufaceView:SurfaceView?= null
var CAMERA_PERMISSION_REQUEST_CODE=12;
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.activity_opengl)

        // 检查相机权限
        if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA ) != PackageManager.PERMISSION_GRANTED) {
            // 权限未授予，请求权限
            ActivityCompat.requestPermissions(this,
                arrayOf(
                    Manifest.permission.CAMERA, Manifest . permission . WRITE_EXTERNAL_STORAGE,
                    Manifest.permission.RECORD_AUDIO), CAMERA_PERMISSION_REQUEST_CODE);
        } else {
            // 权限已授予，打开摄像头


//            surfaceView=findViewById(R.id.camera_view) as SurfaceView
//
//            surfaceView?.holder?.addCallback(this)
        }
//        sufaceView=findViewById(R.id.surface_view)

        Log.e(TAG, getFilesDir().toString()+"jieguo" );

    }

    private  val TAG = "MainActivity2"
}